package com.tdd.api.server.domain.param;

import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotEmpty;
import java.io.Serializable;

/**
 * @author: TDD
 * @Description:统一请求格式
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
@ApiModel(value = "ReqEntity")
@Data
public class ReqEntity<T>  implements Serializable {

    @ApiModelProperty(value = "设备编号",example = "D0001")
    @NotEmpty(message = "设备ID不能为空")
    private String deviceId;

    @ApiModelProperty(value = "加密数据",example = "E2B0ED609EB156598713FBD811913EDA48")
    @NotEmpty(message = "加密参数不能为空")
    private String encrypted;

    @ApiModelProperty(value = "时间戳（10位）",example = "1665059566")
    @NotEmpty(message = "时间戳不能为空")
    private String timestamp;

    @ApiModelProperty(value = "请求数据")
    private T data;

    public ReqEntity(){
    }

    public Object getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    @Override
    public String toString() {
        return "RespEntity{" +
                "deviceId=" + deviceId +
                ", message='" + encrypted + '\'' +
                ", data=" + data +
                '}';
    }
}
